/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2024-08-04
 * Time: 18:48
 */
class MyCircularQueue {
    public int rear=-1;
    public int front=0;
    int[] array;
    int size=0;

    public MyCircularQueue(int k) {
        array=new int[k];
    }

    public boolean enQueue(int value) {
        if(isFull()){
            return false;
        }
        rear++;
        rear=rear%array.length;
        array[rear]=value;
        size++;
        return true;
    }

    public boolean deQueue() {
        if(isEmpty()){
            return false;
        }
        front++;
        front=front%array.length;
        size--;
        return true;
    }

    public int Front() {
        if (isEmpty()){
            return -1;
        }
        return array[front];
    }

    public int Rear() {
        if(isEmpty()){
            return -1;
        }
        return array[rear];
    }

    public boolean isEmpty() {
        return size==0;
    }

    public boolean isFull() {
        return size==array.length;
    }
}
